<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;"> 
<div class="page">
  <div class="fixed-bar">
    <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
      <div class="subject">
        <h3>性格特点详情</h3>
        <h5>性格添加与管理</h5>
      </div>
    </div>
  </div>
    <!--表单数据-->
    <form method="post" id="addEditCharacterForm" >
    <div class="ncap-form-default">
      <dl class="row">
        <dt class="tit">
          <label for="ac_title"><em>*</em>性格特点</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="性格特点" class="input-txt" id="title" name="title" value="{$character.title}">
		  <span class="err" id="err_name" style="color:#F00; display:none;"></span>
            <p class="notic"></p>
        </dd>
      </dl>
      <div class="bot"><a href="JavaScript:void(0);" onClick="verifyForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
    </div>
        <input type="hidden" name="id" value="{$character.id}">
        <input type="hidden" name="p" value="{$_GET[p]}">   
  </form>
</div>
<script>
function verifyForm(){
    var title = $("#title").val();
    if($.trim(title) == '') {
        layer.msg('请输入性格特点！！', {icon: 2});return false;
    }

    $('span.err').show();
    $.ajax({
        type: "POST",
        url: "{:U('Admin/Married/addEditCharacter')}",
        data: $('#addEditCharacterForm').serialize(),
        dataType: "json",
        error: function () {
            layer.alert("服务器繁忙, 请联系管理员!");
        },
        success: function (data) {
            if (data.status == 1) {
                layer.msg(data.msg, {icon: 1},function () {
                    location.href = "{:U('Admin/Married/character_index')}";
                });
            } else {
                layer.msg(data.msg, {icon: 2});
                $.each(data.result, function (index, item) {
                    $('#err_' + index).text(item).show();
                });
            }
        }
    });
}


window.onload = function(){
    var brand_cat_id = parseInt('{$brand.cat_id}');
	if(brand_cat_id > 0 ){
		get_category($("#parent_id_1").val(),'parent_id_2',brand_cat_id);	 
	}		
}
function img_call_back(fileurl_tmp)
{
  $("#logo").val(fileurl_tmp);
  $("#img_a").attr('href', fileurl_tmp);
  $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
}
</script>
</body>
</html>